package de.bht.cge.flightsim.gfx;

import java.io.File;

import de.bht.jvr.core.ShaderMaterial;
import de.bht.jvr.core.ShaderProgram;
import de.bht.jvr.core.Texture;
import de.bht.jvr.core.Texture2D;
import de.bht.jvr.core.pipeline.Pipeline;
import de.bht.jvr.core.uniforms.UniformFloat;

public class CockpitOverlay
{
    private Texture tex;
    private float alpha;
    private ShaderMaterial material;
    
    public CockpitOverlay(String texturepath, float alpha, Pipeline p)    
    {
        this.setAlpha(alpha);
        try
        {
            this.tex = new Texture2D(new File(texturepath));
            ShaderProgram prog = new ShaderProgram(new File("shaders/overlay/cockpitoverlay.vs"), new File("shaders/overlay/cockpitoverlay.fs"));
            this.material = new ShaderMaterial("OVERLAY",prog);
            this.material.setTexture("OVERLAY", "texture", this.tex);
            this.material.setUniform("OVERLAY", "alpha", new UniformFloat(this.getAlpha()));
            
            p.drawQuad(this.material, "OVERLAY");
            
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }
    
    public void printOverlay()
    {
        
    }

    public float getAlpha()
    {
        return alpha;
    }

    public void setAlpha(float alpha)
    {
        this.alpha=alpha;
    }
    
    
    
}
